import enchant

def spellCheckingEnglish(text,pagetitle,file):
	spellChecking(text,pagetitle,file,"en_US")

def spellCheckingFrench(text,pagetitle,file):
	spellChecking(text,pagetitle,file,"fr_FR")

def spellChecking(text,pagetitle,file,language):
	f = open( file,'a')
	dictionary = enchant.Dict(language)
	try:
		if len(text) > 1:
			if dictionary.check(text) == False:
				if language == "en_US":
					f.write('FAIL.non-English::' + text + '::' + pagetitle + '\n')
				else:
					f.write('FAIL.non-Francais::' + text + '::' + pagetitle + '\n')
	except:
		if language == "fr_FR":
			print text+'::Pas charater'
		if language == "en_US":
			print text+'::Not a charater'
	f.close()
